Next | Prev | Up | Top | Contents | Index

The Index Material Extension

The section "Changing Material Properties" in Chapter 6, "Lighting," of the OpenGL Programming Guide, discusses how you can first call glColorMaterial(), then enable GL_COLOR_MATERIAL to have materials track the current RGB color. The index material extension, SGI_index_material, allows the current index to contribute to the computation of the lighting color for color index rendering contexts. Using the index material extension is faster than redefining the material.

It is possible to attach one or more color index material properties to the current index, so that they continuously track its value. This behavior is enabled and disabled by calling call glEnable() or glDisable() with GL_INDEX_MATERIAL specified as the cap parameter. The command that controls which of these modes is then selected is

void IndexMaterial (enum face, enum mode);

face is one of FRONT, BACK, or FRONT_AND_BACK, indicating whether the front material, back material, or both are affected by the current index. mode must be INDEX_OFFSET. The replacements made to material properties are permanent; the replaced values remain until changed by either sending a new index or by setting a new material value when the index material extension is not currently enabled to override that particular value. When INDEX_MATERIAL is enabled, the indicated parameter or parameters always track the current index.

Note that when GL_INDEX_MATERIAL_SGI is enabled, the color produced is first computed as discussed in "Lighting in Color-Index Mode" in Chapter 6, "Lighting," of the OpenGL Programming Guide.

After a final color index is computed, the system follows these steps:

The color index lighting formula is also modified. The lit color index may be bitwise shifted, allowing greater control when using lighting and fog together than in color index mode.



Next | Prev | Up | Top | Contents | Index